<?php

namespace backend\modules\Business\modules\AmoebaBranch\widgets;

use Yii;
use cza\base\widgets\ui\common\part\EntityDetail as DetailWidget;

/**
 * Entity Detail Widget
 *
 * @author Ben Bi <ben@cciza.com>
 * @link http://www.cciza.com/
 * @copyright 2014-2016 CCIZA Software LLC
 * @license
 */
class AssignMember extends DetailWidget
{
    public $withTranslationTabs = false;

    public $withProfileTab = false;

    public $amoebaModel;

    public function getTabItems()
    {
        $items = [];

        if ($this->withTranslationTabs) {
            $items[] = $this->getTranslationTabItems();
        }

        if ($this->withProfileTab) {
            $items[] = $this->getProfileTab();
        }

        if ($this->withBaseInfoTab) {
            $parentAmoebaModel = $this->amoebaModel->parentAmoeba;
            $items[] = [
                'label' => Yii::t('app.c2', 'Base Information'),
                'content' => $this->controller->renderPartial('_assign_member_with_chart', [
                    'model' => $this->model,
                    'amoebaModel' => $this->amoebaModel,
                    'parentAmoebaModel' => $parentAmoebaModel
                ]),
                'active' => true,
            ];
        }

        $items[] = [
            'label' => '<i class="fa fa-th"></i> ' . $this->tabTitle,
            'onlyLabel' => true,
            'headerOptions' => [
                'class' => 'pull-left header',
            ],
        ];

        return $items;
    }
}